-module(act_mgr).
-export([do/1]).

do({cust,add,L}) ->
	{Res,Desc} = cust_adapter:add(L),
    {html,io_lib:format("Result:~p   Desc:~s",[Res,Desc])};
do({cust,check,L}) ->
	cust_adapter:check(L);
do({queue,del_cust,L}) ->
	Vendor_Id = session_service:getLoginedInfo(L,vendor_id),
	Queue_Id = list_to_binary(tools:get_param(L,"id","")),
	{"cust_id",Cust_Index} = lists:keyfind("cust_id",1,L),
	{I_index,_} = string:to_integer(Cust_Index),
	{"tag",Tag} = lists:keyfind("tag",1,L),
	{html,queue_adapter:del_cust(Vendor_Id,Queue_Id,I_index,Tag)};
do({queue,send_sms,L}) ->
	Vendor_Id = session_service:getLoginedInfo(L,vendor_id),
	{"id",Queue_Id} = lists:keyfind("id",1,L),
	{"cust_id",Cust_Index} = lists:keyfind("cust_id",1,L),
	{I_index,_} = string:to_integer(Cust_Index),
	{html,queue_adapter:send_sms(Vendor_Id,Queue_Id,I_index)};
do({queue,add_cust,L}) ->
	queue_adapter:add_cust(L);
do({queue,add,L}) ->
	queue_adapter:add(L),
	io:format("add queue info~n"),
	{html,"<p>OK</p>"};
do({vendor,addchange,L}) ->
	vendor_adapter:addchange(L);
do({vendor,cfg,L}) -> 
	vendor_adapter:cfg(L);
do({vendor,del,L}) ->
	vendor_adapter:del(L);
do({vendor,reset,L}) ->
	vendor_adapter:reset(L);
do({queue,panel_view,L}) ->
    queue_ui:panel_view(L);

do({queue,del,L}) ->
	queue_adapter:del(L);
	
do({queue,addchange,L}) ->
	queue_adapter:addchange(L);

do({queue,adv_set,L}) ->
	queue_adapter:adv_set(L);

do({user,addchange,L}) ->
	user_adapter:addchange(L);

do({user,del,L}) ->
	user_adapter:del(L);

do({user,get,L}) ->
	user_adapter:get(L);

do({user,check_user,L}) ->
	user_adapter:check_user(L);

do({user,assign,L}) ->
	user_adapter:assign(L);

do({register,newReg,L}) ->
	register_adapter:newReg(L);
do({register,quick_create,L}) ->
	register_adapter:quick_create(L);	
do({register,simpleReg,L}) ->
	register_adapter:simpleReg(L);
do({register,delete,L}) ->
	register_adapter:delete(L);

do({g_service,get_active_code,L}) ->
	g_service:get_active_code(L);

do({g_service,confirm_code,L}) ->
	g_service:confirm_code(L);
	
do(_) ->
	none_define.

	